<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCouponsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupons', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('name')->default('')->comment('优惠券名称');
            $table->decimal('coupon_money',8,2)->default(0)->comment('优惠金额');
            $table->decimal('use_ordermoney',8,2)->default(0)->comment('订单满足金额');
            $table->integer('publish_number')->default(0)->comment('发布数量');
            $table->integer('receive_number')->default(0)->comment('领取数量');
            $table->timestamp('expire_at')->nullable()->comment('过期时间');
            $table->timestamp('start_at')->nullable()->comment('开始时间');
            $table->integer('version')->default(1)->comment('辅助版本号');
            $table->string('type')->default('all')->comment('all, shop,active,curse,user(会员)');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupons');
    }
}
